<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>成绩信息管理</title>
<!-- 引入easyui 的主题样式  和  easyui 提供的图标样式 -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css" />
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/icon.css" />
<!-- 引入jquery 和  easyui.js   中文设置js-->
<script type="text/javascript"
	src="${pageContext.request.contextPath}\js\jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
</head>
<script type="text/javascript">
	$(function() {
		//成绩表数据表格
		$('#score').datagrid({
			url : 'score',
			columns : [ [ {
				field : 'ck',
				width : 100,
				checkbox : true
			}, {
				field : 'scid',
				title : '成绩编号',
				width : 100,
				hidden : true
			}, {
				field : 'sid',
				title : '学生学号',
				width : 100
			}, {
				field : 'sname',
				title : '学生姓名',
				width : 100,
			}, {
				field : 'cid',
				title : '课题号',
				width : 100
			}, {
				field : 'cname',
				title : '课题名字',
				width : 400
			}, {
				field : 'score',
				title : '成绩',
				width : 100
			}, ] ],
			rownumbers : true,
			pagePosition : 'bottom',
			pagination : true,
			pageSize : 5,
			pageList : [ 5, 10, 15 ],
			toolbar : []
		});
		

		$('#sid').next().hide();
		$('#sname').next().hide();
		$('#score1').next().hide();
		$('#score2').next().hide();
		$('#searchsid').hide();
		$('#searchsname').hide();
		$('#search').hide();
		$('#totalsid').hide();
		$('#totalsname').hide();
		$('#totalscore').hide();
		//总人数文本框隐藏
		$("#sum").next().hide();
		$("#sumsid").next().hide();
		$("#sumsname").next().hide();
		$("#sumscore").next().hide();
		//学生学号菜单按钮
		$('#sidmenu').menubutton({    
			onClick:function(){
				$('#sid').next().show();
				$('#searchsid').show();
				$('#sname').next().hide();
				$('#score1').next().hide();
				$('#score2').next().hide();
				$('#searchsname').hide();
				$('#search').hide();
				$('#total').hide();
				$('#totalsid').show();
				$('#totalsname').hide();
				$('#totalscore').hide();
			}   
		}); 
		//学生姓名菜单按钮
		$('#snamemenu').menubutton({    
			onClick:function(){
				$('#sname').next().show();
				$('#searchsname').show();
				$('#sid').next().hide();
				$('#score1').next().hide();
				$('#score2').next().hide();
				$('#searchsid').hide();
				$('#search').hide();
				$('#total').hide();
				$('#totalsid').hide();
				$('#totalscore').hide();
				$('#totalsname').show();
			}   
		}); 
		//成绩分段菜单按钮
		$('#scoremenu').menubutton({    
			onClick:function(){
				$('#score1').next().show();
				$('#score2').next().show();
				$('#search').show();
				$('#sid').next().hide();
				$('#sname').next().hide();
				$('#searchsid').hide();
				$('#searchsname').hide();
				$('#total').hide();
				$('#totalsid').hide();
				$('#totalsname').hide();
				$('#totalscore').show();
			}   
		}); 
		//根据学生学号查询成绩
		$('#searchsid').linkbutton({
			onClick : function() {
				var sid = $('#sid').textbox('getValue');
				//成绩表数据表格
				$('#score').datagrid({
					url : 'searchscorebysid',
					queryParams : {
						'sid':sid
					},

				})
			}
		});
		//根据学生姓名查询成绩
		$('#searchsname').linkbutton({
			onClick : function() {
				var sname = $('#sname').textbox('getValue');
				//成绩表数据表格
				$('#score').datagrid({
					url : 'searchscorebysname',
					queryParams : {
						'sname':sname
					},

				})
			}
		});
		//根据成绩分段查询成绩
		$('#search').linkbutton({
			onClick : function() {
				var score1 = $('#score1').textbox('getValue');
				var score2 = $('#score2').textbox('getValue');
				//成绩表数据表格
				$('#score').datagrid({
					url : 'searchscore',
					queryParams : {
						'score1' : score1,
						'score2' : score2,
					},

				})
			}
		});
		//搜索返回
		$('#yes').linkbutton({
			onClick : function() {
				$('#score').datagrid({
					url : 'score',			
			})
			$('#searchscores1').panel('close');
				$('#sid').next().hide();
				$('#sname').next().hide();
				$('#score1').next().hide();
				$('#score2').next().hide();
				$('#searchsid').hide();
				$('#searchsname').hide();
				$('#search').hide();
				$('#totalsid').hide();
				$('#totalsname').hide();
				$('#totalscore').hide();
				//总人数文本框隐藏
				$("#sum").next().hide();
				$("#sumsid").next().hide();
				$("#sumsname").next().hide();
				$("#sumscore").next().hide();
			}
		});
		
		//总人数
		$('#total').linkbutton({
			onClick : function() {
				$("#sum").next().show();
				$.ajax({
					url:'totalStudent',
					type:'post',
					data:{},
					dataType:'json',
					success:function(data){						
						var total = data.total;
				     $('#sum').textbox('setValue',total);
					}
				})
			}
		});
		//总人数根据学生学号	
		$('#totalsid').linkbutton({
			onClick : function() {
				$("#sumsid").next().show();
				var sid = $('#sid').textbox('getValue');
				$.ajax({
					url:'totalStudentBySid',
					type:'post',
					data:{'sid':sid},
					dataType:'json',
					success:function(data){										
						var total = data.total;
				     $('#sumsid').textbox('setValue',total);
					}
				})
			}
		});
		//总人数根据学生姓名
		$('#totalsname').linkbutton({
			onClick : function() {
				$("#sumsname").next().show();
				var sname = $('#sname').textbox('getValue');
				$.ajax({
					url:'totalStudentBySname',
					type:'post',
					data:{'sname':sname},
					dataType:'json',
					success:function(data){										
						var total = data.total;
				     $('#sumsname').textbox('setValue',total);
					}
				})
			}
		});
		//总人数根据学生成绩分段
		$('#totalscore').linkbutton({
			onClick : function() {
				$("#sumscore").next().show();
				var score1 = $('#score1').textbox('getValue');
				var score2 = $('#score2').textbox('getValue');
				$.ajax({
					url:'totalStudentByScore',
					type:'post',
					data:{'score1':score1,
							'score2':score2	
					},
					dataType:'json',
					success:function(data){										
						var total = data.total;
				     $('#sumscore').textbox('setValue',total);
					}
				})
			}
		});
	})
</script>
<body>
	
	<!-- 搜索栏 -->
		<span>搜索：</span><a href="javascript:void(0)" id="sidmenu" class="easyui-menubutton"
			data-options="menu:'#menu'">学生学号</a>
		<div id="menu" style="width: 150px;">
			<div id="snamemenu">学生姓名</div>
			<div id="scoremenu">成绩分段</div>
		</div>
		<a id="yes"  name = "yes" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-undo'">搜索返回</a>
		<a id="total"  name = "total" href="#" class="easyui-linkbutton">总人数</a>
	<input class="easyui-textbox" id="sum" type="text" name="sum"
			style="width: 100px; height: 25px">
			

		<input class="easyui-textbox" id="sid" type="text" name="sid" data-options="buttonText:'学生学号：',buttonAlign:'left'"
			style="width:300px; height: 25px"><a id="searchsid"
			name="searchsid" href="#" class="easyui-linkbutton"
			data-options="iconCls:'icon-search'">搜索</a>
			<a id="totalsid"  name = "totalsid" href="#" class="easyui-linkbutton">总人数</a>
	<input class="easyui-textbox" id="sumsid" type="text" name="sumsid"
			style="width: 100px; height: 25px">
	
		<input class="easyui-textbox" id="sname" type="text" name="sname" data-options="buttonText:'学生姓名：',buttonAlign:'left'"
			style="width: 300px; height: 25px"><a id="searchsname"
			name="searchsname" href="#" class="easyui-linkbutton"
			data-options="iconCls:'icon-search'">搜索</a>
				<a id="totalsname"  name = "totalsname" href="#" class="easyui-linkbutton">总人数</a>
	<input class="easyui-textbox" id="sumsname" type="text" name="sumsname"
			style="width: 100px; height: 25px">

		<input class="easyui-textbox" id="score1" type="text" name="score1" data-options="buttonText:'成绩分段：',buttonAlign:'left'"
			style="width: 300px; height: 25px"> <input
			class="easyui-textbox" id="score2" type="text" name="score2" data-options="buttonText:'至：',buttonAlign:'left'"
			style="width: 300px; height: 25px"> <a id="search"
			name="search" href="#" class="easyui-linkbutton"
			data-options="iconCls:'icon-search'">搜索</a>
			<a id="totalscore"  name = "totalscore" href="#" class="easyui-linkbutton">总人数</a>
	<input class="easyui-textbox" id="sumscore" type="text" name="sumscore"
			style="width: 100px; height: 25px">
	<!-- 成绩表 -->
	<table id="score"></table>
</body>
</html>